<!DOCTYPE HTML>
<html>
    <head>
        <title>read and update cookie</title>
        <meta name="auther" content="wangjiale"/>
        <meta name="description" content="A simper example"/>
    </head>
    <body>
        <p id="cookiedata">
        </p>
        <button id="write">Add Cookie</button>
        <button id="update">Update Cookie</button>
    </body>
    <script>
        var cookieCount=0;
        document.getElementById("write").onclick=createCookie;
        document.getElementById("update").onclick=updateCookie;
        readCookies();
        function readCookies(){
            document.getElementById("cookiedata").innerHTML=document.cookie;
        }
        function createCookie(){
            cookieCount++;
            document.cookie="Cookie_"+cookieCount+"=Value_"+cookieCount;
            readCookies();
        }
        function updateCookie(){
            document.cookie="Cookie_"+cookieCount+"=Update_"+cookieCount;
            readCookies();
        }
    </script>
</html>